package com.smile.search.controller;

import com.smile.search.service.MallSearchService;
import com.smile.search.vo.SearchParam;
import com.smile.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {
   @Autowired
   MallSearchService mallSearchService;
    @GetMapping({"/","index.html",})
    public String ListPage(SearchParam searchParam, Model model){
     SearchResult result =  mallSearchService.search(searchParam);
     model.addAttribute("result",result);
     return "index";
    }
}
